package com.godyao.interceptor;

import com.godyao.framework.beans.factory.BeanFactory;
import com.godyao.framework.beans.factory.BeanFactoryAware;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class UserServiceInterceptor implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        long l = System.currentTimeMillis();

        try {
            return methodInvocation.proceed();
        } finally {
            System.out.println("监控 Begin by AOP");
            System.out.println("方法名称：" + methodInvocation.getMethod().getName());
            System.out.println("方法耗时：" + (System.currentTimeMillis() - l) + "ms");
            System.out.println("监控END");
        }

    }


}
